//
//  Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//

#import "TSMention.h"
#import "SignalServiceKit/SignalServiceKit-Swift.h"

@implementation TSMention

- (instancetype)initWithUniqueMessageId:(NSString *)uniqueMessageId
                         uniqueThreadId:(NSString *)uniqueThreadId
                             uuidString:(NSString *)uuidString
{
    if (self = [super init]) {
        _uniqueMessageId = uniqueMessageId;
        _uniqueThreadId = uniqueThreadId;
        _uuidString = uuidString;
        _creationTimestamp = [NSDate new];
    }

    return self;
}

- (nullable instancetype)initWithCoder:(NSCoder *)coder
{
    return [super initWithCoder:coder];
}

// --- CODE GENERATION MARKER

// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
// `sds_codegen.sh`.

// clang-format off

- (instancetype)initWithGrdbId:(int64_t)grdbId
                      uniqueId:(NSString *)uniqueId
               creationTimestamp:(NSDate *)creationTimestamp
                 uniqueMessageId:(NSString *)uniqueMessageId
                  uniqueThreadId:(NSString *)uniqueThreadId
                      uuidString:(NSString *)uuidString
{
    self = [super initWithGrdbId:grdbId
                        uniqueId:uniqueId];

    if (!self) {
        return self;
    }

    _creationTimestamp = creationTimestamp;
    _uniqueMessageId = uniqueMessageId;
    _uniqueThreadId = uniqueThreadId;
    _uuidString = uuidString;

    return self;
}

// clang-format on

// --- CODE GENERATION MARKER

#pragma mark -

- (SignalServiceAddress *)address
{
    return [[SignalServiceAddress alloc] initWithUuidString:self.uuidString];
}

@end
